Actor BloodScourge : MWeapBloodScourge// replaces MWeaponPiece1
{
	Tag "BloodScourge"
	Weapon.YAdjust 0
	Weapon.KickBack 0
	Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
	Weapon.SelectionOrder 5
	+UNDROPPABLE
	+WEAPON.ALT_AMMO_OPTIONAL
	Inventory.PickupSound "pickup/four"
	Inventory.PickupMessage "BLOODSCOURGE"
	States
	{
	Select:
		MSTF A 1 A_Raise
		TNT1 A 0 A_Raise
		Loop
	Deselect:
		MSTF A 0 A_StopSound(CHAN_WEAPON)
		MSTF A 1 A_Lower
		TNT1 A 0 A_Lower
		Loop
	Spawn:
		BDSC Z -1
		Stop
	Ready:
		MSTF A 0 A_StopSound(CHAN_WEAPON)
		MSTF AAAAAABBBBBBCCCCCCDDDDDDEEEEEEFFFFF 1 A_WeaponReady
		Loop
	Fire:
		MSTF G 1 offset(0,42)
		MSTF H 1 bright offset(0,48) A_MStaffAttack
		MSTF H 1 bright offset(0,48) A_SetPitch(Pitch-2)
		MSTF H 0 bright offset(0,48) a_mstaffpalette
		MSTF HH 1 bright offset(0,48) A_SetPitch(Pitch+1)
		MSTF I 1 offset(0,48) a_mstaffpalette
		MSTF I 1 offset(0,40) a_mstaffpalette
		MSTF J 1 offset(-3,37)
		MSTF J 1 offset(2,38)
		MSTF J 1 offset(-1,35)
		MSTF J 1 offset(-2,37)
		MSTF J 1 offset(-3,36)
		MSTF C 1 offset(2,37)
		MSTF C 1 offset(-1,35)
		MSTF D 1 offset(1,35)
		MSTF D 1 offset(-1,37)
		MSTF E 1 offset(2,36)
		MSTF E 1 offset(-1,35)
		MSTF F 1 offset(1,34)
		MSTF F 1 offset(-1,33)
		goto ready
	AltFire:
		MSTF H 0 A_JumpIfInventory("Mana1", 2, 1)
		Goto Ready
		MSTF H 0 A_JumpIfInventory("Mana2", 2, 1)
		Goto Ready
		MSTF G 1 Offset (0, 33)
		MSTF G 1 Offset (0, 36)
		MSTF G 1 Offset (0, 40)
		MSTF G 1 Offset (0, 44)
		MSTF H 0 Bright A_PlaySound("MageStaffFlame", CHAN_WEAPON, 1.0, 1)
    AltHold:
		MSTF H 0 A_JumpIfInventory("Mana1", 2, 1)
		Goto Ready
		MSTF H 0 A_JumpIfInventory("Mana2", 2, 1)
		Goto Ready
		
		MSTF H 0 Bright A_TakeInventory("Mana1", 2, TIF_NOTAKEINFINITE)
		MSTF H 0 Bright A_TakeInventory("Mana2", 2, TIF_NOTAKEINFINITE)
		MSTF H 0 Bright A_SetPitch(pitch-0.25)
		MSTF H 1 bright offset(1,47) A_FireCustomMissile("MageStaffFlame",frandom(-3,3),0,0,0)
		MSTF H 1 bright offset(-1,47) A_SetPitch(pitch+0.25)
		MSTF H 0 Bright A_SetPitch(pitch-0.25)
		MSTF H 1 bright offset(1,45) A_FireCustomMissile("MageStaffFlame",frandom(-3,3),0,0,0)
		MSTF H 1 bright offset(-1,45) A_SetPitch(pitch+0.25)
		MSTF H 0 Bright A_SetPitch(pitch-0.25)
		MSTF H 1 bright offset(1,47) A_FireCustomMissile("MageStaffFlame",frandom(-3,3),0,0,0)
		MSTF H 1 bright offset(-1,47) A_SetPitch(pitch+0.25)
		MSTF H 0 Bright A_SetPitch(pitch-0.25)
		MSTF H 1 bright offset(1,45) A_FireCustomMissile("MageStaffFlame",frandom(-3,3),0,0,0)
		MSTF H 1 bright offset(-1,45) A_SetPitch(pitch+0.25)
		MSTF H 0 Bright A_SetPitch(pitch-0.25)
		MSTF H 1 bright offset(1,47) A_FireCustomMissile("MageStaffFlame",frandom(-3,3),0,0,0)
		MSTF H 1 bright offset(-1,47) A_SetPitch(pitch+0.25)
		MSTF H 0 Bright A_SetPitch(pitch-0.25)
		MSTF H 1 bright offset(1,46) A_FireCustomMissile("MageStaffFlame",frandom(-3,3),0,0,0)
		MSTF H 1 bright offset(-1,46) A_SetPitch(pitch+0.25)
		MSTF H 1 bright offset(2,48)
		MSTF I 0 Offset (1, 44) A_ReFire
		MSTF I 1 Offset (1, 44) A_StopSound(CHAN_WEAPON)
		MSTF I 1 Offset (1, 41)
		MSTF I 1 Offset (1, 40)
		MSTF I 1 Offset (1, 38)
		MSTF I 1 Offset (1, 36)
		MSTF J 2 Offset (1, 33)
		Goto Ready
	}
}

ACTOR MageStaffFlame
{
	Radius 5
	Height 8
	Speed 19
	Damage 0//(random(1,8)*3+ACS_ExecuteWithResult(WOC_DECORATE,STATS,INTELLECT,TARGET)-10)
	Projectile
	+DOOMBOUNCE
	+EXPLODEONWATER
	+MTHRUSPECIES +NODAMAGETHRUST
	+DONTBLAST
	BounceFactor 1.0
	XScale 0.85
	RenderStyle Add
	Damagetype "Fire"
	States
	{
	Spawn:
		FX06 A 0
		FX06 A 0 Bright ThrustThingZ(0,frandom(-3,3),0,1)
		FX06 ABC 2 Bright A_FadeOut
		Loop
	Death:
		FX06 D 0 Bright A_Explode(40*0.025*(30+ACS_executewithresult(WOC_DECORATE,STATS,INTELLECT,TARGET))-20,48,0)
		FX06 DEFG 5 Bright
		Stop
	}
}

Actor NewMageStaffFX2 : MageStaffFX2 Replaces MageStaffFX2
{
	Damage (frandom(8,28)*0.025*(30+ACS_executewithresult(WOC_DECORATE,STATS,INTELLECT,TARGET)))
	+MTHRUSPECIES +NODAMAGETHRUST
	+DONTBLAST
	+HITTRACER
	Radius 8
	States
	{
	Spawn:
		MSP2 A 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 A 0 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 A 1 Bright A_MStaffTrack
		MSP2 A 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 A 1 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 B 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 B 0 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 B 1 Bright A_MStaffTrack
		MSP2 B 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 B 1 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 C 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 C 0 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 C 1 Bright A_MStaffTrack
		MSP2 C 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 C 1 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 D 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 D 0 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		MSP2 D 1 Bright A_MStaffTrack
		MSP2 D 0 Bright A_CustomMissile("BloodscourgeFXSpawner",0,0,0,4)
		MSP2 D 1 Bright A_SpawnItemEx("NewMageStaffFX2ExplosionDamage")
		Loop
	Death:
		MSP2 E 0 Radius_Quake(2,15,0,3,0)
		MSP2 E 0 Bright A_ChangeFlag("NODAMAGETHRUST", 1)
		MSP2 F 0 A_JumpIfInTargetInventory("IsPyro",1,"Pyro")
		MSP2 F 0 Bright A_Explode(80*0.025*(30+ACS_executewithresult(WOC_DECORATE,STATS,INTELLECT,TARGET)), 192, 0)
		MSP2 E 4 Bright A_SetTranslucent(1,1)
		MSP2 FGH 5 Bright
		MSP2 I 4 Bright
		Stop
	Pyro:
		MSP2 F 0 Bright A_Explode(80*0.025*(30+ACS_executewithresult(WOC_DECORATE,STATS,INTELLECT,TARGET)), 192, 0, 0, 192)
		MSP2 E 4 Bright A_SetTranslucent(1,1)
		MSP2 FGH 5 Bright
		MSP2 I 4 Bright
		Stop
	}
}

Actor NewMageStaffFX2ExplosionDamage
{
	Speed 0
	Height 4
	Radius 4
	Damage (0)
	+MISSILE
	+DONTBLAST
	+NOBLOCKMAP
	+NOGRAVITY
	+DONTSPLASH
	-TELESTOMP
	+NODAMAGETHRUST
	+PAINLESS
	Damagetype "Fire"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInTargetInventory("IsPyro",1,"Pyro")
		TNT1 A 1 A_Explode(3*0.025*(acs_executewithresult(WOC_DECORATE,STATS,INTELLECT,TARGET)),8,0)
		Stop
	Pyro:
		TNT1 A 1 A_Explode(3*0.025*(acs_executewithresult(WOC_DECORATE,STATS,INTELLECT,TARGET)),8,0,0,8)
		Stop
	}
}

Actor BloodscourgeFXSpawner
{
	+NoBlockMap +NoGravity +NoSector +NoInteraction +NoClip -Solid +CLIENTSIDEONLY +DONTBLAST
	states
	{
	Spawn:
	Active:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(Args[1], "Circle")
		TNT1 A 2
		TNT1 A 0 A_SpawnItemEx ("BloodScourgeParticleFX", 0, frandom(-6, 6), frandom(-6, 6), 0, (0.5)*frandom(-4, 4), (0.5)*frandom(-4, 4), frandom(0,360), 129, Args[2])
		//    TNT1 A 0 A_SpawnItemEx ("BloodScourgeParticleFX", 0, frandom(-6, 6), frandom(-6, 6), 0, (0.5)*frandom(-3, 3), (0.5)*frandom(-3, 3), frandom(0,360), 129, Args[2]) 
		Stop
	Circle:
		TNT1 A 0
		TNT1 A 2 A_SpawnItemEx ("BloodScourgeParticleFX", frandom(-Args[0], Args[0]), 0, frandom(0, 8), (0.1)*frandom(1, 3), 0, (0.1)*frandom(1, 10), frandom(0, 360), 129, Args[2]) 
		Loop
	Inactive:
		TNT1 A 1
		Loop
	}  
}

ACTOR BloodScourgeParticleFX
{
	+Missile
	+NoBlockmap
	+NoInteraction
	-Solid
	+CLIENTSIDEONLY +DONTBLAST
	+DONTBLAST
	Radius 0
	Height 0
	RenderStyle Add
	Alpha 0.5
	Scale 0.35
	Gravity 0.25
	States
	{
	Spawn:
		MSP2 AABBCCDD 1 Bright A_FadeOut(0.02)
		Loop
	}
}